// JavaScript Document

(function(){
	var festivalTheme = [
		{
			festival: "newyear",
			startDate: "2010/12/31",
			endDate: "2011/01/04"	
		},
		{
			festival: "springfestival",
			startDate: "2011/01/26",
			endDate: "2011/02/18",
			logoTitle: "2011，新春快乐！",
			popLink: {
				text: "迎兔年，送祝福！",
				url: "http://www.hezheng.cc"
			}
		}
	]
	for(var i = 0; i < festivalTheme.length; i ++){
		var thisTime = Date.parse(new Date());
		var start = Date.parse(festivalTheme[i].startDate);
		var end = Date.parse(festivalTheme[i].endDate);
		if(thisTime > start && thisTime < end){
			document.write('<link href="/Public/css/' + festivalTheme[i].festival + '.css" rel="stylesheet" type="text/css" />');
			if(festivalTheme[i].logoTitle){
				title = festivalTheme[i].logoTitle;
				$(document).ready(function(){
					$("#logo a").attr("title", title);
				});
			}
			if(festivalTheme[i].popLink){
				text = festivalTheme[i].popLink.text;
				url = festivalTheme[i].popLink.url;
				str = '<a href="' + url + '" target="_blank">' + text + '</a>'
				$(document).ready(function(){
					$("#header .con").append('<span class="wish-pop">' + str + '</span>');
					$(".maxim").html(str);
				});
			}
		}
	}
})();